\section{Compressor Model}
\label{sec:mod:comp}

The single compressor unit used in this work, depicted in \fig{mod:single-comp}, refers to a centrifugal compressor driven by a variable-speed electric driver, with a tank at both the inlet (suction) and outlet (discharge).
Both the suction and discharge tanks are connected to atmospheric pressure by a valve.
These suction and discharge valves represent the flow conditions upstream and downstream of the compressor, respectively, such that various flow conditions and disturbances can be simulated by simply changing the position of the valves.
The artificial disturbances applied using these valves are designed to mimic situations frequently encountered in industrial applications (e.g. shutdown or startup of a downstream compressor).
A third, recycle (or anti-surge) valve connects the outlet tank to the inlet tank. Its primary purpose is to open when the compressor approaches surge in order to decrease the compressor load and increase the mass flow through the compressor, thus pulling it away from the surge line.

\begin{figure}
  \centering
  \resizebox{0.8\linewidth}{!}{%
    \begin{tikzpicture}
      \drawcomp
    \end{tikzpicture}
  }
  \caption{Compressor model used in simulation.}
  \label{fig:mod:single-comp}
\end{figure}



\subsection{States}
The compressor model used is based on the Gravdahl-Greitzer model described in \cite{Gravdahl1999}. It is defined by five states: the suction (\g{ps}) and discharge (\g{pd}) pressures, the mass flow through the compressor (\g{qc}), the rotational speed of the compressor (\g{omegac}), and the mass flow rate through the recycle valve (\g{qr}).
The differential equations governing these states are given by:

\begin{equation}
    \dt{} \ubrace{\begin{bmatrix}
      \g{ps}\\
      \g{pd}\\
      \g{qc}\\
      \g{omegac}\\
      \g{qr}
    \end{bmatrix}}{\g{nominalstate}} =
    \ubrace{\begin{bmatrix}
      \frac{\g{a}^2}{\g{Vs}}\left(\g{qs}+\g{qr}-\g{qc}\right)\\
      \frac{\g{a}^2}{\g{Vd}}\left(\g{qc}-\g{qr}-\g{qd}\right)\\
      \frac{\g{A}}{\g{lc}}\left(\gi{Pi}\left(\g{alpha},\ \g{omegac},\ \g{qc} \right)\g{ps} - \g{pd}  \right)\\
      \frac{1}{\g{Jcomp}}\left(\g{torque} - \g{airtorque}\left(\g{beta},\ \g{omegac},\ \g{qc}\right)\right)\\
      \frac{1}{\g{taur}}\left(\g{ur} - \g{urSP} \right)
    \end{bmatrix}}{\g{nominalderiv}}
  \label{eq:mod:single_comp_states}
\end{equation}

\begin{equation}
  \begin{split}
    q_\text{s} & = q_\text{s}(\vc{\gamma},\ u_{\text{s}},\ p_\text{s},\ p_{\text{in}})\\
    q_\text{r} & = q_\text{r}(\vc{\delta},\ u_\text{r},\ p_\text{s},\ p_\text{d})\\
    q_\text{d} & = q_\text{d}(\vc{\varepsilon},\ u_{\text{d}},\ p_{\text{out}},\ p_\text{d}),
  \end{split}
\end{equation}

\noindent where:

\begin{itemize}[noitemsep]
  \item \g{a} is the speed of sound;
  \item \g{Vs} and \g{Vd} are the suction and discharge tank volumes, respectively;
  \item \g{qs}, \g{qr}, and \g{qd} are the mass flows across the suction valve, recycle valve, and discharge valve, respectively;
  \item \g{A} is the cross-sectional area of the piping after the compressor and \g{lc} the duct length;
  \item \gi{Pi}$\left(\g{alpha},\g{omegac}, \g{qc} \right)$ is the steady-state pressure ratio across the compressor, and \g{alpha} contains the coefficients mapping this ratio to the compressor speed and mass flow;
  \item \g{Jcomp} is the inertia of the system;
  \item \g{beta} contains the parameters mapping the steady-state torque results from air compression to the mass flow and rotational speed of the compressor;
  \item \g{taur} and \g{urSP} are the time constant of the recycle valve and its setpoint, respectively;
  \item \g{gamma}, \g{delta} and \g{epsilon} are the coefficients mapping mass flow through the suction, recycle and discharge valves, respectively, to the pressure differential across the valve;
  \item \g{us} and \g{ud} are the positions of the suction and discharge valves, respectively;
  \item \g{pin} and \g{pout} are the pressures upstream and downstream of the compressor, respectively; and
  \item \g{nominalstate} and \g{nominalderiv} are vectors representing the nominal state and state derivative of a single compressor, respectively.
\end{itemize}

The interested reader may refer to \cite{Cortinovis2015} for further information on the identification and validation of this model.

\subsection{Inputs}

The inputs to the compressor system are the positions of the suction, discharge and recycle valves, as well as the torque setpoint of the electric driver powering the compressor.
It is assumed that a cascaded regulator maintains the torque at the desired setpoint with a dynamic response fast enough to be neglected at the time scales considered (on the order of tens of ms).
Torque is chosen as the input variable as it allows a faster response time compared to driver speed, which is generally slower as it requires the use of cascaded torque and speed controllers.
It should be noted that the torque can be adjusted in time scales on the order of tens of milliseconds while the valves move on the order of hundreds of milliseconds.

The specific recycle valve being modelled has a dead time between when the input signal is applied and when the valve moves.
This characteristic is also typical of valves used in industrial applications.
In general, this dead time varies as a function of the valve position, with the worst case occurring when the valve is opened from a fully-closed position.
For simplification, however, it was assumed constant and equal to the worst-case dead-time, identified in \cite{Cortinovis2015} to be \u{2}{s}.
This dead time was modelled using additional, delayed states as described in \sect{mpc:linearization}.

For control purposes, the torque input to the driver and the recycle valve position were used as manipulated variables, while the suction and discharge valves were used to apply disturbances to the system. The system input vector is therefore given by:

\begin{equation}
  \g{un} = \begin{bmatrix} \g{torque} \\ \g{ur} \end{bmatrix}
\end{equation}

\subsection{Outputs}
\label{sec:mod:comp:outputs}

Industrial compressor installations, as well as the system being modelled, typically have sensors measuring the compressor states described above, as well as several other temperatures, pressures and mass flow rates.
The choice of outputs used in the model for control purposes is thus not unique, and can be adjusted depending on the requirements of each installation.
In this case, the variable used for process control is the discharge pressure of the compressor.


For anti-surge control, however, the standard controlled output used is the surge distance or surge control distance (equivalent up to a constant offset), defined in \sect{intro:compressor}.
It cannot be measured but is instead estimated based on the current operating point and an experimentally-determined estimate of the surge line position on the compressor map.

The surge line is estimated to be a straight line in the compressor map using the pressure ratio (\g{Pi}) and mass flow rate (\g{qc}) as coordinates, defined by the equation:

\begin{equation}
  \gii{Pi} = a_1 \giii{qc} + a_2,
\end{equation}

\noindent where \gii{Pi} and \giii{qc} are the pressure ratio and mass flow rate on the surge line, respectively, and $a_1$ and $a_2$ are experimentally-determined coefficients.  
The surge distance is given by:

\begin{equation}
  \g{sd} = \left(\ubrace{\frac{\g{pd}}{\g{ps}}\frac{1}{a_1} - \frac{a_2}{a_1}}{\giii{qc}}\right) - \g{qc}.
\end{equation}

The output vector used for control purposes is thus:

\begin{equation}
  \g{yn} = 
  \begin{bmatrix}
    \g{pd}\\
    \g{sd}.
  \end{bmatrix}
\end{equation}


